package com.wortox;

import com.wortox.getPrice.SumPrice1;
import com.wortox.getPrice.SumPrice2;
import com.wortox.getPrice.SumPrice3;
import com.wortox.pojo.Fruit;
import com.wortox.setPrice.FruitPrice;

import java.util.*;

public class Solution {

    public static void main(String[] args) {
        //问题一
        Map fruitMap = new HashMap();
        fruitMap.put("apple", 10);
        fruitMap.put("strawberry", 10);
        SumPrice1 sumPrice1 = new SumPrice1();
        Integer price1 = sumPrice1.getPrice(fruitMap);
        System.out.println("问题一price = " + price1);

        //问题二
        //设置芒果的价格
        List<Fruit> fruitPrice = FruitPrice.getInstance().getFruitPrice();
        Fruit fruit = new Fruit();
        fruit.setName("mongo");
        fruit.setPrice(2000);
        fruitPrice.add(fruit);

        fruitMap.put("mongo", 10);
        Integer price2 = sumPrice1.getPrice(fruitMap);
        System.out.println("问题二price = " + price2);

        //问题三
        SumPrice2 sumPrice2 = new SumPrice2();
        Integer price3 = sumPrice2.getPrice(fruitMap);
        System.out.println("问题三price = " + price3);

        //问题四
        SumPrice3 sumPrice3 = new SumPrice3();
        Integer price4 = sumPrice3.getPrice(fruitMap);
        System.out.println("问题四price = " + price4);
    }
}
